#!/bin/bash
# 在k8s主节点执行

# 批量替换命名空间
namespace="devops-ns"
sed -i "s/#NAME_SPACE_VAR__#/${namespace}/g" 01.namespace.yaml
sed -i "s/#NAME_SPACE_VAR__#/${namespace}/g" 02.pv.yaml
sed -i "s/#NAME_SPACE_VAR__#/${namespace}/g" 03.secret.yaml
sed -i "s/#NAME_SPACE_VAR__#/${namespace}/g" 04.redis-statefulset.yaml
sed -i "s/#NAME_SPACE_VAR__#/${namespace}/g" 05.elasticsearch-statefulset.yaml
sed -i "s/#NAME_SPACE_VAR__#/${namespace}/g" 06.filebeat-daemonset.yaml
sed -i "s/#NAME_SPACE_VAR__#/${namespace}/g" 07.logstash-deployment.yaml
sed -i "s/#NAME_SPACE_VAR__#/${namespace}/g" 08.mysql-statefulset.yaml
sed -i "s/#NAME_SPACE_VAR__#/${namespace}/g" 09.rocketmq-statefulset.yaml
sed -i "s/#NAME_SPACE_VAR__#/${namespace}/g" 10.seata-server-statefulset.yaml
sed -i "s/#NAME_SPACE_VAR__#/${namespace}/g" 11.sentinel-deployment.yaml
sed -i "s/#NAME_SPACE_VAR__#/${namespace}/g" 12.ingress-nginx.1.6.4.deploy.yaml
sed -i "s/#NAME_SPACE_VAR__#/${namespace}/g" 13.proxy-path-ingress.yaml
sed -i "s/#NAME_SPACE_VAR__#/${namespace}/g" 14.service.yaml

# kubectl delete -f .
kubectl apply -f .

